<?php
                include("global.php"); 
                $id = @urldecode($_GET["id"]); 
                printHeader(false);
                session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it">
    <head>
        <style>
        body {
                    text-align: left;
            }
/* error message */
.error {
	height:15px;
	background-color:#FFFE36;
	font-size:11px;
	border:1px solid #E1E16D;
	padding:4px 10px;
	color:#000;
	display:none;	
	
	-moz-border-radius:4px;
	-webkit-border-radius:4px; 
	-moz-border-radius-bottomleft:0;
	-moz-border-radius-topleft:0;	
	-webkit-border-bottom-left-radius:0; 
	-webkit-border-top-left-radius:0;
	
	-moz-box-shadow:0 0 6px #ddd;
	-webkit-box-shadow:0 0 6px #ddd;	
}

</style>
        <link media="screen" type="text/css" href="style/form.css" rel="stylesheet" />
	<link media="screen" type="text/css" href="style/formcheck.css" rel="stylesheet" /> 
<!--        <link rel="stylesheet" type="text/css" href="style/impvtabs.css" />-->
        <link rel="stylesheet" type="text/css" href="style/button.css" />
        <script type="text/javascript" src="files/js/core.js"></script>
	<script type="text/javascript" src="files/js/more.js"></script>
        <script type="text/javascript" src="files/js/lang/it.js"></script> 
        <script src="files/js/jquery-1.4.2.js" type="text/javascript"></script>
	<script type="text/javascript" src="files/js/jquery.tools.min.js"></script> 
        <script type="text/javascript" src="files/js/jquery.js"></script> 

        <script type="text/javascript" src="files/js/ajax_chpasswd.js"></script> 
        
        
        <script type="text/javascript" >
        
        window.addEvent('domready', function(){
            new FormCheck('formular');
        });

		</script>
        <style>
                    .button_imp{
                      
                        margin-bottom: 3px;
						margin-top: 30px;
                    }

                    .cancel_imp{
						margin-left: 191px;
						margin-top: -35px;
                    }
                    select {
                        width: 250px;
                        color: #555;
                        padding: 4px 4px 3px;
                        border: 2px solid #B5B8C8;
                        font-size: 14px;
                        margin-top: 4px;
                        margin-bottom: 4px;
                        background: #FFFFFF;
                }
        </style>
    </head>
    
    <body>
                <?php
                
                if($id == "admin")
                {
                        print("<fieldset>
                            <form class=\"formular\" id=\"chlogin_form\" method=\"post\" action=\"#\">
                                <fieldset> 			
                                    <legend>cambio password Admin </legend>
                                    <label> 					
                                        <span>Old Password : </span>
                                        <input type=\"password\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"oldPasswordAdmin\" required=\"required\" pattern=\".{3,}\"/> 				
                                    </label>
                                    <label>
                                        <span>New Password : </span>
                                        <input type=\"password\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"newPasswordAdmin\" required=\"required\" pattern=\".{3,}\"/>
                                    </label>

                                 <div class=\"button_imp\"> 
                                    <input type=\"submit\" value=\"Salva\" class=\"buttonview\" /> 
                                </div>
                                <div class=\"cancel_imp\"> 
                                    <input type=\"reset\"  value=\"Reset\" class=\"buttonglosalva\" /> 			
                                </div>
                                 <span id=\"msgboxAdmin\" style=\"display:none\"></span>
                    ");
                    print("</fieldset></form></fieldset>");
                }
                else if($id == "user")
                {
                                        
                    print("<fieldset>
                            <form class=\"formular\" id=\"chlogin_form\" method=\"post\" action=\"#\">
                                <fieldset> 
                                    <legend>cambio password User </legend>				
                                    <label> 					
                                        <span>Old Password : </span>
                                        <input type=\"password\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"oldPasswordUser\" required=\"required\" pattern=\".{3,}\"/>				
                                    </label>
                                    <label>
                                        <span>New Password : </span>
                                        <input type=\"password\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"newPasswordUser\" required=\"required\" pattern=\".{3,}\"/>
                                    </label>

                                <div class=\"button_imp\"> 
                                    <input type=\"submit\" value=\"Salva\" class=\"buttonview\" /> 
                                </div>
                                <div class=\"cancel_imp\"> 
                                    <input type=\"reset\"  value=\"Reset\" class=\"buttonglosalva\" /> 			
                                </div>
                                
                                 <span id=\"msgboxAdmin\" style=\"display:none\"></span>
                    ");
                    print("</fieldset></form></fieldset>");
                }
                else if($id == "stato")
                    {
                        $msql  = new Db;
                        $msql->connect();
                        $sql="SELECT data FROM data_schedulazione";
                        $result=$msql->execute_select($sql);
                         print("<fieldset>
                            <form class=\"formular\" id=\"chlogin_form\" method=\"post\" action=\"#\">
                                <fieldset> 
                                    <legend>Impostazioni dello stato del sistema</legend>				
                                    <label> 					
                                        <span>Seleziona intervallo temporale per il Controllo del funzionamento <i>argini Fiumi Uniti.</i> </span>
                                        <br/><br/>				
                                    </label>
                                    <label>
                                        <span>Seleziona ora (es. selezionando 1 ora il sistama verra controllato ogni ora): </span>
                                    
                                        <select id=\"ora\">");
                                             for($i=1; $i < 25; $i++)
                                                if($i == $result[0][0])
                                                    printf ("<option value=\"%d\" selected=\"yes\">%02d Ora</option>", $i,$i);
                                                else
                                                    printf ("<option value=\"%d\">%02d Ora</option>", $i,$i);
                          
                        print("</select> </label> ");
                      
                        print ("<label> 					
                        <span>Seleziona intervallo temporale per l'archiviazione e l'invio dei dati</span>
                        <br/><br/>				
                        </label>
                        <label>
                        <span>Seleziona intervallo (es. selezionando 1 anno saranno archiviati i dati di un anno fa' e l'archivio sar&agrave; inviato all'indirizzo email selezionato per allarme del tipo: <i>Funzionamento sistema)</i> </span>
                        <select id=\"giorni\">");
                         for($i=90; $i < 540; $i=$i+90)
                         {  
                               echo $i."---\n";
                                if($i == $result[1][0])
                                        printf ("<option value=\"%d\" selected=\"yes\">%02d mesi</option>", $i,($i/30));
                                else
                                        printf ("<option value=\"%d\" >%02d mesi</option>", $i,($i/30));                         
                         }
                         print("</select> </label><br/><br/> ");
                         print("
                                <div class=\"button_imp\"> 
                                    <input type=\"submit\" value=\"Salva\" class=\"buttonview\" /> 
                                </div>
                                <div class=\"cancel_imp\"> 
                                    <input type=\"reset\"  value=\"Reset\" class=\"buttonglosalva\" /> 			
                                </div>
                                
                                 <span id=\"msgboxAdmin\" style=\"display:none\"></span>");
                        print("</fieldset></form></fieldset>");
                     }
                else
                {
                 
                    $msql  = new Db;
                    $msql->connect();
//                    if($id == "ftp1")
//                    {
//                        $sql="SELECT ftp_ip,ftp_name,ftp_user,ftp_password,ftp_date,vpn_server,vpn_user,vpn_password FROM ftp_table WHERE ftp_id=1";
//                        $result=$msql->execute($sql);
//                        $row=mysql_fetch_array($result);
//                        
//                        
//                        print("<fieldset>
//                                <fieldset>
//                                <form class=\"formular\" id=\"chlogin_form\" method=\"post\" action=\"\">
//                                    <fieldset> <legend>Impostazioni Vpn </legend>				
//                                        <label> 					
//                                            <span>Vpn Server : </span>
//                                            <input type=\"text\" value=\"".$row['vpn_server']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"vpnServer\" required=\"required\" pattern=\".{3,}\"/>				
//                                        </label>
//                                        <label>
//                                            <span>Vpn User : </span>
//                                            <input type=\"text\" value=\"".$row['vpn_user']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"vpnUser\" pattern=\".{3,}\"/>
//                                        </label>
//                                         <label>
//                                        <span>Vpn Password : </span>
//                                            <input type=\"password\" value=\"".$row['vpn_password']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"vpnPassword\" pattern=\".{3,}\"/>
//                                        </label>
//                                    </fieldset>");
//                        
//                        print("
//                               
//                                    <fieldset> <legend>Ftp ".$row['ftp_name']." </legend>				
//                                        <label> 					
//                                            <span>Ftp IP : </span>
//                                            <input type=\"text\" value=\"".$row['ftp_ip']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"ftpIP_1\" required=\"required\" pattern=\".{3,}\"/>				
//                                        </label>
//                                        <label>
//                                            <span>Ftp User : </span>
//                                            <input type=\"text\" value=\"".$row['ftp_user']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"ftpUser_1\" pattern=\".{3,}\"/>
//                                        </label>
//                                         <label>
//                                        <span>Ftp Password : </span>
//                                            <input type=\"password\" value=\"".$row['ftp_password']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"ftpPassword_1\" pattern=\".{3,}\"/>
//                                        </label>
//                                        <span>Giorni validit&agrave; impostazioni: </span>
//                                            <input type=\"text\" value=\"".$row['ftp_date']."\" class=\"validate['required','length[3,-1]','digit'] text-input\" id=\"ftpDate_1\" required=\"required\" pattern=\"[0-9]{1,3}\"/>
//                                        </label>
//                                        <input type=\"hidden\" value=\"".$row['ftp_name']."\" id=\"ftpName_1\"/>
//                                        
//                                    <div class=\"button_imp\"> 
//                                    <input type=\"submit\" value=\"Salva\" class=\"buttonview\" /> 
//                                    </div>
//                                    <div class=\"cancel_imp\"> 
//                                        <input type=\"reset\"  value=\"Reset\" class=\"buttonglosalva\" /> 			
//                                    </div>
//                                    <span id=\"msgboxAdmin\" style=\"display:none\"></span>
//                        ");
//                         print("</fieldset></form></fieldset>");
//                     } else   
                     if($id == "ftp2")
                     {
                        $sql="SELECT ftp_ip,ftp_name,ftp_user,ftp_password,ftp_date FROM ftp_table WHERE ftp_id=2";
                        $result=$msql->execute($sql);
                        $row=mysql_fetch_array($result);
                        
                                           
                        print("<fieldset>
                                <form class=\"formular\" id=\"chlogin_form\" method=\"post\" action=\"\">
                                     <fieldset> <legend>Ftp ".$row['ftp_name']." </legend>			
                                        <label> 					
                                            <span>Ftp IP : </span>
                                            <input type=\"text\" value=\"".$row['ftp_ip']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"ftpIP_2\" required=\"required\" pattern=\".{3,}\"/>				
                                        </label>
                                        <label>
                                            <span>Ftp User : </span>
                                            <input type=\"text\" value=\"".$row['ftp_user']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"ftpUser_2\" pattern=\".{3,}\"/>
                                        </label>
                                         <label>
                                        <span>Ftp Password : </span>
                                            <input type=\"password\" value=\"".$row['ftp_password']."\" class=\"validate['required','length[3,-1]','alphanum'] text-input\" id=\"ftpPassword_2\" pattern=\".{3,}\"/>
                                        </label>
                        
                                        <span>Giorni validit&agrave; impostazioni: </span>
                                            <input type=\"text\" value=\"".$row['ftp_date']."\" class=\"validate['required','length[3,-1]','digit'] text-input\" id=\"ftpDate_2\" required=\"required\" pattern=\"[0-9]{1,3}\"/>
                                        </label>
                                         <input type=\"hidden\" value=\"".$row['ftp_name']."\" id=\"ftpName_2\"/>
                                    
                                    <div class=\"button_imp\"> 
                                        <input type=\"submit\" value=\"Salva\" class=\"buttonview\" /> 
                                    </div>
                                    <div class=\"cancel_imp\"> 
                                        <input type=\"reset\"  value=\"Reset\" class=\"buttonglosalva\" /> 			
                                    </div>
                                    <span id=\"msgboxAdmin\" style=\"display:none\"></span>
                        ");
                         print("</fieldset></form></fieldset>");
                     }
                      
                     $msql->disconnettiDB();
                }
              ?>
    <br />
<script>
//$("#formular").validator();
</script>
</body></html>
